package net.pimpas.report.processor.projection.impl;

import net.pimpas.report.processor.exception.ProjectionException;
import net.pimpas.report.processor.field.Field;
import net.pimpas.report.processor.projection.AbstractProjection;
import net.pimpas.report.processor.projection.ProjectionType;
import net.pimpas.report.processor.resolver.FieldPropertyResolver;

import org.hibernate.criterion.Projection;
import org.hibernate.criterion.Projections;

public class MinProjection extends AbstractProjection {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3020680831609118220L;

	public MinProjection(Field field) {
		super(field, ProjectionType.MIN);
	}

	@Override
	public Projection process(String fieldAlias, FieldPropertyResolver resolver) throws ProjectionException {
		return Projections.min(fieldAlias);
	}
}